//
// File:	ResourceManagerTypes.hpp
// Author:	Thomas TISSOT-DUPONT
// Login:	<thomas.tissotdupont@free.fr>
//
// Created:	14/04/2010 at 15:56:56
// Purpose:	
//
#ifndef RESOURCEMANAGERTYPES_HPP
#define RESOURCEMANAGERTYPES_HPP

#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include "Trace.hpp"

//------------------------------------------------------------------
// ImageManager
//------------------------------------------------------------------
template <>
inline sf::Image *ResourceManager<sf::Image>::LoadFromFile(const std::string &fileName)
{
	sf::Image *pImage = new sf::Image();
	if (pImage->LoadFromFile(fileName) == false)
	{
		delete pImage;
		return NULL;
	}
	return pImage;
}
typedef ResourceManager<sf::Image> ImageResourceManager;

//------------------------------------------------------------------
// SoundManager
//------------------------------------------------------------------
template <>
inline sf::SoundBuffer *ResourceManager<sf::SoundBuffer>::LoadFromFile(const std::string &fileName)
{
	sf::SoundBuffer *pSoundBuffer = new sf::SoundBuffer();
	if (pSoundBuffer->LoadFromFile(fileName) == false)
	{
		delete pSoundBuffer;
		return NULL;
	}
	return pSoundBuffer;
}
typedef ResourceManager<sf::SoundBuffer> SoundResourceManager;

#endif //!RESOURCEMANAGERTYPES_HPP
